package com.xujie.sportsmeeting.common.result;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 响应状态码枚举
 */
@Getter
@AllArgsConstructor
public enum ResultCode {
    
    // 通用状态码
    SUCCESS(200, "操作成功"),
    ERROR(500, "操作失败"),
    PARAM_ERROR(400, "参数错误"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),
    
    // 认证相关
    UNAUTHORIZED(401, "未登录或登录已过期"),
    FORBIDDEN(403, "权限不足"),
    TOKEN_INVALID(4001, "Token无效"),
    TOKEN_EXPIRED(4002, "Token已过期"),
    
    // 用户相关
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_DISABLED(1002, "用户已被禁用"),
    USERNAME_EXISTS(1003, "用户名已存在"),
    PASSWORD_ERROR(1004, "密码错误"),
    OLD_PASSWORD_ERROR(1005, "原密码错误"),
    
    // 运动员相关
    ATHLETE_NOT_FOUND(2001, "运动员不存在"),
    ATHLETE_EXISTS(2002, "运动员已存在"),
    STUDENT_NUMBER_EXISTS(2003, "学号已存在"),
    
    // 裁判员相关
    JUDGE_NOT_FOUND(3001, "裁判员不存在"),
    JUDGE_EXISTS(3002, "裁判员已存在"),
    WORK_NUMBER_EXISTS(3003, "工号已存在"),
    
    // 比赛项目相关
    EVENT_NOT_FOUND(4001, "比赛项目不存在"),
    EVENT_CODE_EXISTS(4002, "项目编码已存在"),
    EVENT_REGISTRATION_CLOSED(4003, "项目报名已关闭"),
    EVENT_MAX_PARTICIPANTS_REACHED(4004, "项目报名人数已满"),
    
    // 报名相关
    REGISTRATION_NOT_FOUND(5001, "报名记录不存在"),
    REGISTRATION_EXISTS(5002, "已报名该项目"),
    REGISTRATION_AUDIT_ERROR(5003, "报名审核失败"),
    
    // 成绩相关
    SCORE_NOT_FOUND(6001, "成绩记录不存在"),
    SCORE_EXISTS(6002, "成绩已存在"),
    
    // 公告相关
    NOTICE_NOT_FOUND(7001, "公告不存在"),
    
    // 系统相关
    ROLE_NOT_FOUND(8001, "角色不存在"),
    PERMISSION_NOT_FOUND(8002, "权限不存在"),
    DATABASE_ERROR(9001, "数据库操作失败"),
    FILE_UPLOAD_ERROR(9002, "文件上传失败"),
    
    // 通用操作
    DATA_NOT_FOUND(9003, "数据不存在"),
    OPERATION_ERROR(9004, "操作失败");
    
    private final Integer code;
    private final String message;
}
